<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link href="__STATIC__/plugin/layui/css/layui.css" rel="stylesheet" />
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
    <link rel="stylesheet" href="__STATIC__/imgsee/css/bootstrap-grid.min.css">
    <link rel="stylesheet" href="__STATIC__/imgsee/dist/zoomify.min.css">
    <link rel="stylesheet" href="__STATIC__/imgsee/css/style.css">

</head>
<body>

<blockquote class="layui-elem-quote layui-text">
    发表文章
</blockquote>

<form class="layui-form" action="">
    <div class="layui-form-item">
        <label class="layui-form-label">说明</label>
        <div class="layui-input-block">
            <input type="text" name="title" lay-verify="title" autocomplete="off"  class="layui-input" disabled value="{$data.desc}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">用户名</label>
        <div class="layui-input-block">
            <input type="text" name="title" lay-verify="title" autocomplete="off"  class="layui-input" disabled value="{$data.user}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">联系电话</label>
        <div class="layui-input-block">
            <input type="text" name="title" lay-verify="title" autocomplete="off"  class="layui-input" disabled value="{$data.contact}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">单选框</label>
        <div class="layui-input-block">
            <input type="radio" name="status" value="2" title="有用" {if condition="$data.status==2"}checked{/if}>
            <input type="radio" name="status" value="3" title="没用" {if condition="$data.status==3"}checked{/if} >
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">照片</label>
        <div class="layui-input-block example" >
            {volist name="data.imgs" id="img"}
            <img src="{$img}" alt="" style="width:150px;height:150px;border-radius:50%;">
            {/volist}
        </div>
    </div>
    <div class="layui-form-item" >
        <label class="layui-form-label"></label>
        <div class="layui-input-block">
            <textarea placeholder="请输入内容" class="layui-textarea" disabled>{$data.content}</textarea>        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"></label>
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="edit">确定</button>
        </div>
    </div>
</form>
<!-- 配置文件 -->
<script type="text/javascript" src="__STATIC__/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="__STATIC__/ueditor/ueditor.all.js"></script>
<!-- 实例化编辑器 -->

<script src="https://cdn.bootcss.com/jquery/2.1.3/jquery.min.js"></script>
<script src="__STATIC__/plugin/layui/layui.js"></script>
<script src="__JS__/common.js"></script>
<script src="__STATIC__/imgsee/dist/zoomify.min.js"></script>
<script type="text/javascript">
    $('.example img').zoomify();
</script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
    var id = {$id};
    layui.define(['form', 'layedit','upload'], function (exports) {

        var form = layui.form()
            , layedit = layui.layedit
            ,upload = layui.upload;


        form.on('submit(edit)', function(data){
            var index = layer.load(1);
            var url = baseUrl+"api/v1/broke/"+id;
            var data = $('form').serialize();

            urlAjax(url,data,function(data){
                    layer.close(index);
                    if(data.status){
                        layer.msg(data.info, { icon: 5 });
                    }else{
                        layer.msg(data.info, { icon: 6 });
                        layer.closeAll('page');
                        setTimeout(function(){
                            location.href = data.url;
                        },1500);
                    }
                },
                function(){
                    layer.close(index);
                    layer.msg('网络错误，请重试', { icon: 5 });
                },'PUT');

            return false;
        });
    });

</script>

</body>
</html>